import React, { Component } from "react";
import styles from "./index.less";
import { Input, Modal } from "antd-mobile";
import Request, { Delete, Get } from "./../../../utils/request";
class Page extends Component {
  state = {
    pwd: "",
    npwd: ""
  };
  componentDidMount() {}
  changePwd = () => {
    Request("/sys/user/change/pwd", {
      pwd: this.state.pwd,
      npwd: this.state.npwd
    }).then(res => {
      console.log(res);
      Modal.alert({
        content: "修改成功",
        onConfirm: () => {
          console.log("Confirmed");
        },
      });
      document.cookie = "";
      window.location.href =
        window.location.href.split("#")[0] + "";
    });
  };
  render() {
    const { text } = this.props;
    const { userInfo, list, saoma, decodedText, decodedResult } = this.state;
    return (
      <div className={'settingPage'}>
        <div className={'title'}>修改个人信息</div>
        <div className={'changePwdWrap'}>
          <div className={'changePwdItem'}>
            <div className={'desc'}>旧密码</div>
            <div className={'input'}>
              <Input
                value={this.state.pwd}
                onChange={e => this.setState({ pwd: e })}
              />
            </div>
          </div>
          <div className={'changePwdItem'}>
            <div className={'desc'}>新密码</div>
            <div className={'input'}>
              <Input
                value={this.state.npwd}
                onChange={e => this.setState({ npwd: e })}
              />
            </div>
          </div>
        </div>
        <div className={'scanWrap'}>
          <div className={'scan'} onClick={this.changePwd}>
            确定
          </div>
        </div>
      </div>
    );
  }
}

export default Page;
